(function () {
    // let data={} 将url？后面的参数解析成对象  写着玩的
    // location.search.slice(1).split("&").forEach(item=>{
    //     let arr= item.split("=")
    //     data[arr[0]]=arr[1];
    // });
    // console.log(data);
    let productid = location.search.slice(1).split("=")[1];
    getData()

    function getData() {
        $.ajax({
            url: "http://chst.vip:1234/api/getmoneyctrlproduct?",
            data: {
                productid
            }
        }).then(res => {
            createContent(res.result)
        })
    }

    function createContent(data) {
        let html = data.reduce((value, item) => {
            return value += `
                <h3 class="title">${item.productName}</h3>
                <div class="other">
                    <a class="form">${item.productFrom}</a>
                    <span class='tiem'>${item.productTime}</span>
                    <span claaa='tip'>${item.productTips}</span>
                </div>
                <div class='info'>
                    ${item.productImgSm}
                    ${item.productInfo2}
                </div>
                <div class='img'>${item.productImgLg}</div>
                <div class='city'>${item.productCity}</div>
            `
        }, '')
        $("#main .res").html(html)
        let txt = data.reduce((value, item) => {
            return value += `
            ${item.productComment}
            `
        }, '')
        $("#main .liuyan").html(txt)
    }
    //返回顶部动漫效果
    $("footer>.nav li").eq(2).click(function () {
        $("html").stop().animate({
            scrollTop: 0
        }, 200)
    })
}())